#include "disturbingcontroller.h"

void DisturbingController::alarm(){

}
void DisturbingController::startTracking(){
    _running = true;
}
void DisturbingController::stopTracking(){
    _running = false;
}
DisturbingController::DisturbingController(){
    _feedback = new FeedbackAction();
    _sensor = new QAmbientLightSensor();

    QObject::connect(_sensor, SIGNAL(QAmbientLightSensor::readingChanged()), this, SLOT(doStuff()));
    _sensor->start();
}
DisturbingController::~DisturbingController(){
    delete _sensor;
    delete _feedback;
}

void DisturbingController::doStuff(){
        QAmbientLightReading* r = _sensor->reading();
        qDebug("ASDASD");
        switch(r->lightLevel()){
            case QAmbientLightReading::Dark: {
                    _feedback->startNoise();
                    break;
                }
            case QAmbientLightReading::Bright: {
                    _feedback->stopNoise();
                    break;
                }
            case QAmbientLightReading::Light: {
                    _feedback->stopNoise();
                    break;
                }
            case QAmbientLightReading::Sunny: {
                    _feedback->stopNoise();
                    break;
                }
            case QAmbientLightReading::Twilight: {
                    _feedback->stopNoise();
                    break;
                }
            case QAmbientLightReading::Undefined: {
                    _feedback->stopNoise();
                    break;
                }

            }

}
